#property copyright "Ron Thompson" #property link "http://www.lightpatch.com/forex" // This EA is NEVER to be SOLD individually // This EA is NEVER to be INCLUDED as part of a collection that is SOLD // // goldfish (flopping around like a goldfish out of water) // #property copyright "Ron Thompson" #property link "http://www.ForexMT4.com/" // generic user input extern double Lots=0.1; extern int TrailStop=30; // start the flopping at a LONG position bool FSell=false; // where to go next bool FBuy=true; // for Future Buy/Sell datetime bartime; int bartick=0; int Slippage=2; // File handling int handle=0; // naming and numbering double MagicNumber = 200512062015; string TradeComment = "goldfish"; //+------------------------------------+ //| Custom init (usually empty on EAs) | //|------------------------------------| // Called ONCE when EA is added to chart // or expert is re-compiled int init() { Comment(TradeComment); } //+------------------------------------+ //| Custom deinit(usually empty on EAs)| //+------------------------------------+ // Called ONCE when EA is removed from chart int deinit() { Comment(" "); } //+------------------------------------+ //| EA main code | //+------------------------------------+ // Called EACH TICK int start() { double p=Point; double spread=Ask-Bid; int cnt=0; int OpenOrders=0; double gainloss; double SL; double TP; // use bar movement to prevent multiple orders per bar if(bartime!=Time[0]) { bartime=Time[0]; bartick++; } for(cnt=0; cnt (TrailStop*p) ) { SL=Bid-(TrailStop*p); TP=OrderTakeProfit(); OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP, White); } }//buy if(OrderType()==OP_SELL) { gainloss=OrderStopLoss()-Ask; if ( gainloss > (TrailStop*p) ) { SL=Ask+(TrailStop*p); TP=OrderTakeProfit(); OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP, Red); } }//sell } // if(OrderSymbol) } // for } // start()